package sg.edu.nus.iss.billing.dao;

import sg.edu.nus.iss.billing.model.account.Account;
import sg.edu.nus.iss.billing.model.bill.BillGeneratedHistory;
import sg.edu.nus.iss.billing.model.user.User;

/**
 * @author 	Saravana Kumar
			Yeo Hee Ling
			Ananda Purna Pryana
			Bee Hong
			Koo Eng Khoon
			Thureim
			Yin Ni Tun
			Zhou Zifeng
 */

public class DaoFactory  {

	public static String dataDirection = "data/datasource/";
	
	private static DaoFactory instance = new DaoFactory();
	
	public static synchronized DaoFactory getInstance() {
		if (instance == null) {
			instance = new DaoFactory();
		}
		return instance;
	}
	
	public static BaseDAO<User> getUserDAO(String dataName) {
		BaseDAO<User> dao = new BaseDAO<User>(dataDirection, dataName, User.class);
		return dao;
	}
	
	public static BaseDAO<Account> getAccountDAO(String dataName) {
		BaseDAO<Account> dao = new BaseDAO<Account>(dataDirection, dataName, Account.class);
		return dao;
	}
	
	public static BaseDAO<BillGeneratedHistory> getBillGeneratedHistoryDAO(String dataName) {
		BaseDAO<BillGeneratedHistory> dao = new BaseDAO<BillGeneratedHistory>(dataDirection, dataName, BillGeneratedHistory.class);
		return dao;
	}
}
